<script language="javascript">
var dialogWidth=$(window).width()*0.2;
var dialogHeight=$(window).height()*0.06*4;
$(function(){
	$("#searchBtn").click(function(){
		artDialog(
		        {	
			        'title':'按条件查询',
			        width:dialogWidth,
			        height:  dialogHeight ,
			        okVal:"查询",
			        cancelVal:'关闭',
		            content:"<form id='searchForm' method='get' action='/user/tradeLog'>"+$('#searchdiv').html()+"</form>",
		            lock:true,
		        },
		        function(){
		                $('#searchForm').submit();
		        },
		        function(){
		            return true;
		        }
		);
		});
});
</script>
<!--  搜索表单  -->
<div  id="searchdiv" style="display:none;">
<input  type='hidden'  name='sid' value='<?php echo $sid?>'/>
 <table style="width:100%;height:100%" border=0>
	<tr>
	  <td valign='middle' align="right"  style="padding:1  1 1 1;width:20%"   >用户UID</td><td  valign='middle' align="left"  >
		<input type='text' name="uid" style="padding:1  1 1 1;width:80%"  value='<?php echo isset($get['uid'])?$get['uid']:''?>' />
	  </td>
	</tr>
	<tr>
	<td valign='middle' align="right"  style="padding:1  1 1 1;width:20%"   >类型</td>
	<td valign='middle' style="padding:1  1 1 1;width:80%"   >
		<select name='kp'>
		<option value = "">All</option>
			<option value="open" <?php echo isset($get['kp']) && $get['kp']=='open'?"selected":"";?>>开仓</option>
			<option value="close" <?php echo isset($get['kp']) && $get['kp']=='open'?"selected":"";?>>平仓</option>
		</select>
	</td>
	</tr>
	<tr>
	  <td valign='middle' align="right"  style="padding:1  1 1 1;width:20%"   >开始时间</td><td  valign='middle' align="left"  >
		<input type='text' name="sdate" style="padding:1  1 1 1;width:80%"  onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" value='<?php echo isset($get['sdate'])?$get['sdate']:''?>' />
	  </td>
	</tr>
	<tr>
	  <td valign='middle' align="right"  style="padding:1  1 1 1;width:20%"   >结束时间</td><td  valign='middle' align="left"  >
		<input type='text' name="edate" style="padding:1  1 1 1;width:80%"  onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" value='<?php echo isset($get['edate'])?$get['edate']:''?>' />
	  </td>
	</tr>
 </table>
  <input  type="submit" value="提交"   style="display:none" />
</div>

<div class="container-fluid">
    <div class="widget-box">
		<div class="widget-title">
			<span class="icon">
				<i class="icon-th"></i>
			</span>
			<h5>交易记录</h5>
			<span style="height:38px;line-height:38px;">
				<input class="btn btn-success btn-mini" type="button" style="cursor:pointer" id='searchBtn'  value="搜索条件">
				<a  href="/user/tradeLog?sid=<?php echo $sid;?>" class="btn btn-info btn-mini">清空查询</a>
			</span>
		</div>
		<div class="widget-content nopadding">
			<table   style="width:100%" class='table table-bordered table-striped'>
				<thead>
				<tr class="strong">
					<th>UID</th>
					<th>产品</th>
					<th>类型</th>
					<th>方向</th>
					<th>数量</th>
					<th>持仓价</th>
					<th>成交价</th>
					<th>盈亏</th>
					<th>备注</th>
					<th>时间</th>
				</tr>
				</thead>
				<tbody>
				<?php if(!empty($page_data)) foreach($page_data as $items){?>
				<tr>
					<td><?php echo $items['uid'];?></td>
					<td><?php echo isset($productDesc[$items['name']])?$productDesc[$items['name']]:$items['name'];?></td>
					<td><?php echo $items['dtype']=='cny'?"人民币":"体验劵";?></td>
					<td><?php echo $items['bs']=='ask'?"多":"空";?></td>
					<td><?php echo $items['num'];?></td>
					<td><?php echo $items['chi_price'];?></td>
					<td><?php echo $items['cj_price'];?></td>
					<td>￥ <?php echo $items['yk'];?></td>
					<td><?php echo isset($sourceList[$items['source']])?$sourceList[$items['source']]:$items['source'];?></td>
					<td><?php echo $items['date'];?></td>
				</tr>            		
				<?php }?>
				</tbody>
			</table>
		</div>
		<div id="page" style="width:50%" class="dataTables_paginate fg-buttonset ui-buttonset fg-buttonset-multi ui-buttonset-multi paging_full_numbers">
		   <?php echo $page_html;?>
		</div>
  </div>
  </div>